using Tatibah;

namespace Images
{
	// See the DocumetAPI.PDF fro the results
    class Program
    {
        static void Main(string[] args)
        {
            // Create the document
            Document document1 = new Document(@"C:\Tatibah\Results\Images.docx");

			// Create a Paragraph and add an Image to it
            Paragraph paragraph = new Paragraph("No scaling");
            Image image1 = new Image(@"C:\Word\Images\image1.png");
            paragraph.Append(image1);
            // Add Paragraph to Document
            document1.Append(paragraph);

            // Scale Image to 2.5 cm in width
            Image image2 = new Image(@"C:\Word\Images\image2.png");
            // To get the Image Width and height set we must save the Image to the Document.
            document1.SaveImage(image2);
            image2.Scaling = (double)Document.cmsToEMUs(2.5) /
                (double)image1.Width * 100.0; // width is in EMUs
            paragraph = new Paragraph("Scaled to 2.5 centimetres (or 1 inch)");
            paragraph.Append(image2);
            document1.Append(paragraph);

            // Same Image scaled vertically 150% with a Green border
            paragraph = new Paragraph("Scaled vertically 150% with a Yellow border");
            image2.HeightScaling = 150.0;
            image2.WidthScaling = 100; // Reset Width scaling to 100%. 
            image2.BorderWidth = 5; // 1 Point
            image2.BorderColour = Document.ColourToHex(System.Drawing.Color.Yellow);
            paragraph.Append(image2);
            document1.Append(paragraph);

            // Save the Document
            document1.Save();
            document1.Close();

        }
    }
}
